from GLOBALPATH import Global

from gensim.models import KeyedVectors



file = Global.word2vec_txt_path
wv_from_text = KeyedVectors.load_word2vec_format(file, limit=9000, binary=False) # 加载时间比较长
wv_from_text.init_sims(replace=True)
word = '膝关节置换手术'
if word in wv_from_text.wv.vocab.keys():
    vec = wv_from_text[word]
    print(wv_from_text.most_similar(positive=[vec], topn=20))
else:
    print("没找到")